module.exports = function($scope, $state, $modal,toaster,$resource){
    $scope.searchform = {};
      
    $scope.maxSize = 5;            //最多显示多少个按钮
    $scope.bigCurrentPage = 1;      //当前页码
    $scope.itemsPerPage = 10;         //每页显示几条
    
    $scope.loadlist = function(){
        var para = {
            pageNo:$scope.bigCurrentPage, 
            pageSize:$scope.itemsPerPage
        };
        para = angular.extend($scope.searchform, para);
        $resource('/api/as/mc/juyoucard/cardrangelist', {}, {}).save(para, function (res) {
          if (res.errcode === 0) {
            $scope.cardrangelist = res.data.results;
            $scope.bigTotalItems = res.data.totalRecord;
          } else {
            toaster.error({ title: '', body: res.errmsg });
          }
        });
    };	
    $scope.loadlist();  
    // 往卡池里添加卡
    $scope.add = function(){   
        var modalInstance = $modal.open({
          template: require('../views/adddistributioncard.html'),
          controller: 'adddistributioncard',
          size: 'lg',
          resolve: {
            // bean: function () {
            //   return bean;
            // }
          }
        });
        //关闭模态框刷新页面
        modalInstance.result.then(function () {
            $scope.loadlist();
        });
 
    }
    
    

   
};